home *** CD-ROM | disk | FTP | other *** search
- * Program.: DOS-TIME.PRG
- * Author..: Anonymous, Luis A. Castro, Robert Goldin
- * Date....: 07/01/83, 10/31/83, 01/20/84
- * Notice..: Copyright 1983 & 1984, Ashton-Tate, All Rights Reserved.
- * Version.: dBASE II, version 2.4
- * Notes...: Loads the IBM-PC system time.
- * Local...: t:hour, t:min, t:sec
- *
- * OUT: time:dos-C-8 Time in 24-hour format: [hh:mm:ss]
- * time:ampm-C-8 Time in AM/PM format: [hh:mm AM/PM]
- *
- SET CALL TO 61440
- POKE 61440,180,44,205,33,137,22,13,240,137,14,15,240,195
- CALL
- *
- * ---Get the time values from memory.
- STORE STR(PEEK(61456),2) TO t:hour
- STORE STR(PEEK(61455),2) TO t:min
- STORE STR(PEEK(61454),2) TO t:sec
- *
- * ---Replace leading blanks with leading zeros.
- IF $(t:hour,1,1) = " "
- STORE "0" + $(t:hour,2,1) TO t:hour
- ENDIF
- IF $(t:min,1,1) = " "
- STORE "0" + $(t:min,2,1) TO t:min
- ENDIF
- IF $(t:sec,1,1) = " "
- STORE "0" + $(t:sec,2,1) TO t:sec
- ENDIF
- *
- * ---Concatenate the three variables for 24-hour format.
- STORE t:hour + ":" + t:min + ":" + t:sec TO time:dos
- *
- * ---AM/PM Format Conversion.
- DO CASE
- CASE t:hour = "00"
- STORE "12:" + t:min + " AM" TO time:ampm
- CASE t:hour < "12"
- STORE STR(VAL(t:hour),2)+":"+t:min+" AM" TO time:ampm
- CASE t:hour = "12"
- STORE "12:" + t:min + " PM" TO time:ampm
- CASE t:hour > "12"
- STORE STR(VAL(t:hour)-12,2)+":"+t:min+" PM" TO time:ampm
- ENDCASE
- RELEASE t:hour, t:min, t:sec
- RETURN
- * EOF: DOS-TIME.PRG